#include "TestCurves.h"
#include "../Core/Constants.h"
#include "../Core/MathematicalUtilities.h"
#include <cmath>

namespace cagd
{
    namespace Cornu
    {
        double x(double t)
        {
            return cos(t*t*PI/2.0);
        }

        double y(double t)
        {
            return sin(t*t*PI/2.0);
        }

        unsigned int div_point_count = 100;

        double u_min = -PI;
        double u_max = +PI;

        DCoordinate3 d0(double u)
        {
            return DCoordinate3(Simpson1D(x, 0.0, u, div_point_count), Simpson1D(y, 0.0, u, div_point_count));
        }

        DCoordinate3 d1(double u)
        {
            return DCoordinate3(x(u), y(u));
        }

        DCoordinate3 d2(double u)
        {
            return DCoordinate3(-PI * u * y(u), PI * u * x(u));
        }
    }
}
